<template>
  <div class="defectFixedIndex">
    <userHeader />
    <div class="breadClum">
      <span>
           <router-link :to="{path:'/pageIndex'}">   <a class="bread1">当前位置：首页  >  </a></router-link>
           <router-link :to="{path:'/query'}">  <a class="bread2">综合查询  ></a></router-link>
         <a class="bread2">缺陷整改查询</a>
      </span>
    </div>
    <!--<div class="navList">-->
      <!--&lt;!&ndash;评价企业&ndash;&gt;-->
      <!--<el-dropdown trigger="click" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;width: 80px;text-align: center;"-->
                   <!--@command="handleCommentCompany">-->
          <!--<span class="el-dropdown-link">-->
            <!--{{commentCompany}}<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
          <!--</span>-->
        <!--<el-dropdown-menu slot="dropdown" style="padding: 0 20px;">-->
          <!--<el-dropdown-item :command="0">武汉纺友</el-dropdown-item>-->
          <!--<el-dropdown-item :command="1">武汉纺友1</el-dropdown-item>-->
          <!--<el-dropdown-item :command="2">武汉纺友2</el-dropdown-item>-->
        <!--</el-dropdown-menu>-->
      <!--</el-dropdown>-->

      <!--&lt;!&ndash;评价期间&ndash;&gt;-->
      <!--<el-button type="primary" style="margin-right: 6px;" @click="showCommentPeriod">评价期间</el-button>-->
      <!--<el-dialog-->
        <!--title="请选择要查询的时期"-->
        <!--:visible.sync="isShowCommentPeriod"-->
        <!--width="30%"-->
        <!--style="min-width: 412px;">-->
        <!--<el-date-picker-->
          <!--v-model="commentPeriod"-->
          <!--type="daterange"-->
          <!--range-separator="至"-->
          <!--start-placeholder="开始日期"-->
          <!--end-placeholder="结束日期">-->
        <!--</el-date-picker>-->
        <!--<span slot="footer" class="dialog-footer">-->
            <!--<el-button type="primary" @click="selectCommentPeriod">确 定</el-button>-->
          <!--</span>-->
      <!--</el-dialog>-->


      <!--&lt;!&ndash;评价类型&ndash;&gt;-->
      <!--<el-dropdown trigger="click" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;width: 80px;text-align: center;"-->
                   <!--@command="handleCommentType">-->
          <!--<span class="el-dropdown-link">-->
            <!--{{commentType}}<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
          <!--</span>-->
        <!--<el-dropdown-menu slot="dropdown" style="padding: 0 20px;">-->
          <!--<el-dropdown-item :command="0">年度评价</el-dropdown-item>-->
          <!--<el-dropdown-item :command="1">hello</el-dropdown-item>-->
          <!--<el-dropdown-item :command="2">测试中</el-dropdown-item>-->
        <!--</el-dropdown-menu>-->
      <!--</el-dropdown>-->

      <!--&lt;!&ndash;评价流程&ndash;&gt;-->
      <!--<el-dropdown trigger="click" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;width: 80px;text-align: center;"-->
                   <!--@command="handleCommentProgress">-->
          <!--<span class="el-dropdown-link">-->
            <!--{{commentProgress}}<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
          <!--</span>-->
        <!--<el-dropdown-menu slot="dropdown" style="padding: 0 20px;">-->
          <!--<el-dropdown-item :command="0">年度评价</el-dropdown-item>-->
          <!--<el-dropdown-item :command="1">hello</el-dropdown-item>-->
          <!--<el-dropdown-item :command="2">测试中</el-dropdown-item>-->
        <!--</el-dropdown-menu>-->
      <!--</el-dropdown>-->
      <!--<el-button @click="downLoadFile" :loading="downloadLoading" class="download-file" style="" type="primary" icon="el-icon-download" size="mini"></el-button>-->
    <!--</div>-->
    <div class="navList">
      <el-dropdown  trigger="click" @command="setCompanySelect" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;text-align: center;">
          <span class="el-dropdown-link">
            {{companySelect}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
        <el-dropdown-menu slot="dropdown" style="padding: 0 10px;height: 300px;overflow-y: scroll">
          <el-dropdown-item v-for="item in companyList" :key="item.company_id" :command="item">{{item.company_name}}
          </el-dropdown-item>
          <el-dropdown-item  v-if="companyList.length==0" command="none">
            暂无数据
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <el-dropdown  trigger="click" @command="setEvaluationPeriod" style="margin-right: 6px;cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;text-align: center;" >
          <span class="el-dropdown-link">
            {{evaluationPeriodSelect}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
        <el-dropdown-menu slot="dropdown" style="padding: 0 16px;">
          <el-dropdown-item v-for="item in evaluationPeriodList" :command="item.evaluation_period"
                            :key="item.evaluation_period">{{item.evaluation_period}}年
          </el-dropdown-item>
          <el-dropdown-item  v-if="evaluationPeriodList.length==0" command="none">
            暂无数据
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <el-dropdown trigger="click" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;text-align: center;"
                   @command="handleCommentType">
          <span class="el-dropdown-link">
            {{commentType}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
        <el-dropdown-menu slot="dropdown" style="padding: 0 10px;;height: 300px;overflow-y: scroll">
          <el-dropdown-item  v-for="item in evaluationType" :command="item"
                             :key="item.evaplan_type_id">{{item.evaplan_type_name}}</el-dropdown-item>
          <el-dropdown-item  v-if="evaluationType.length==0" command="noCommentType">
            暂无数据
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>

      <!--评价流程-->
      <el-dropdown trigger="click" style="cursor:pointer;background: #8cc34b;padding:10px 24px;color:#fff;border-radius:4px;text-align: center;"
                   @command="handleCommentProgress">
          <span class="el-dropdown-link">
            {{commentProgress}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
        <el-dropdown-menu slot="dropdown" style="padding: 0 10px;;height: 300px;overflow-y: scroll">
          <el-dropdown-item :command="item" v-for="item in commentProgressArray" :key="item.process_id">{{item.process_name}}</el-dropdown-item>
          <el-dropdown-item  v-if="commentProgressArray.length==0" command="noCommentType">
            暂无数据
          </el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <el-button @click="downLoadFile" :loading="downloadLoading" class="download-file" style="" type="primary" icon="el-icon-download" size="mini"></el-button>
    </div>
    <el-table
      :data="tableData"
      :row-class-name="tableRowClassName2"
      :cell-class-name="cell"
      stripe=""
      :height="height"
      ref="tableData3"
      v-loading="loading"
      current-row-key

      style="width: 100%"
    >
      <el-table-column
        label="编号"
        prop="process_name"
        fixed
      >

      </el-table-column>
      <el-table-column
        label="评价流程"
        prop="process_name"
        fixed
      >
        <template slot-scope="scope">
          {{scope.row.process_name}}
        </template>
      </el-table-column>
      <el-table-column
        label="评价点名称"
        prop="evaluation_content"
      >
        <template slot-scope="scope">
          {{scope.row.evaluation_content}}
        </template>
      </el-table-column>
      <el-table-column
        label="评价标准"
        width="300"
        prop="evaluation_criterion"
      >
      </el-table-column>
      <el-table-column
        label="评价结论"
        prop="defect_title"
        width="300"
      >
      </el-table-column>
      <el-table-column
        prop="defect_source"
        label="缺陷来源"
      >
      </el-table-column>
      <el-table-column
        label="缺陷性质"
        prop="defect_property_text"
      >
      </el-table-column>
      <el-table-column
        label="缺陷影响结果"
        prop="defect_impact_results"
      >
      </el-table-column>
      <el-table-column
        label="改进建议"
        prop="suggestions_improvement"
      >
      </el-table-column>
      <el-table-column
        label="责任部门"
        prop="section_name"
      >
      </el-table-column>
      <el-table-column
        label="责任部门负责人"
        prop="section_principal"
      >
      </el-table-column>
      <el-table-column
        label="整改任务分配"
        prop="dis_current_time"
      >
        <el-table-column
          label="缺陷确认"
          prop="defect_state"
        >
          <template slot-scope="scope">
            <div >
              <p >
                 <span >
                     <b :class="{'e-wrong':true,'e-wrong-active': scope.row.defect_state === '2' }"></b>
                  </span>
                <span >
                      <b :class="{'e-right-active':scope.row.defect_state === '1', 'e-right':true}" ></b>
                    </span>

              </p>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="沟通意见"
          prop="communication_ideas"
        >
          <template slot-scope="scope">
            <div >
              {{scope.row.communication_ideas}}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="整改负责人"
          prop="mend_principal"
          width="100"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell" >
                  {{scope.row.mend_principal[index].name}}
                </div>
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column
        label="编制整改计划"
      >
        <el-table-column
          label="缺陷原因分析"
          prop="defect_reason_analysis"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                  {{scope.row.defect_reason_analysis[index]}}
                </div>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="整改计划"
        >
          <template slot-scope="scope">
            <div class="mend_principal_scope" >
              <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                {{scope.row.rectification_measures[index]}}
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="计划完成时间"
          prop="evaluation_finishtime"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                  {{editorStart_time(scope.row.evaluation_finishtime[index])}}
                </div>
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table-column>
      <el-table-column
        label="复核整改计划"
      >
        <!--rectification_state-->
        <template slot-scope="scope">
          <!--当前编制整改计划已经完成-->
          <div class="mend_principal_scope" >
            <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
              <div >
                <p  >
                  <span >
                     <b :class="{'e-wrong':true,'e-wrong-active': scope.row.rectification_state[index] === '2' }"></b>
                  </span>
                  <span >
                      <b :class="{'e-right-active':scope.row.rectification_state[index] === '1', 'e-right':true}" ></b>
                    </span>
                </p>
              </div>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column
        label="整改结果"
      >
        <el-table-column
          label="整改结果"
          prop="rectification_results"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                  {{scope.row.rectification_results[index]}}
                </div>
              </div>
            </div>
          </template>

        </el-table-column>
        <el-table-column
          label="未整改原因及措施"
          prop="reasons_measures"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                  {{scope.row.reasons_measures[index]}}
                </div>
              </div>
            </div>
          </template>

        </el-table-column>
      </el-table-column>
      <el-table-column
        label="落实整改结果"
      >
        <el-table-column
          label="整改结果确认"
        >
          <template slot-scope="scope">
            <!--当前编制整改计划已经完成-->
            <div class="mend_principal_scope" >
              <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                <div >
                  <p  >
                  <span >
                     <b :class="{'e-wrong':true,'e-wrong-active': scope.row.def_rec_state[index] === '2' }"></b>
                  </span>
                    <span >
                      <b :class="{'e-right-active':scope.row.def_rec_state[index] === '1', 'e-right':true}" ></b>
                    </span>
                  </p>
                </div>
              </div>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="落实意见"
          prop="implementation_opinions"
        >
          <template slot-scope="scope">
            <div >
              <div class="mend_principal_scope">
                <div v-for="(item,index) in scope.row.defect_source" :class="{'hasOne':scope.row.defect_source.length==1,'hasTwo':scope.row.defect_source.length==2}" class="mend_principal_cell">
                  {{scope.row.implementation_opinions[index]}}
                </div>
              </div>
            </div>
          </template>

        </el-table-column>
      </el-table-column>
    </el-table>
    <el-pagination
      :page-count=pageSize
      layout="total,prev, pager, next, jumper"
      :current-page.sync="currentPage"
      @current-change="currentChange"
    >
    </el-pagination>

  </div>
</template>
<script>
  import userHeader from '@/components/header.vue';
  import {formatDateTime,formatgetTime} from '@/utils/index.js';
  import {mapState} from 'vuex';
  export default({
    computed:{
      ...mapState({
        user_id:state=>state.app.loginState.user_id||sessionStorage.getItem('user_id'),
        height:state=>sessionStorage.getItem('height')||state.app.height,
      }),
      editorStart_time(){
        return function (selectTypeArray) {
          if(typeof selectTypeArray =="object"){
            return formatgetTime(selectTypeArray)
          }else{
            return selectTypeArray
          }
        }
      },
      newDateTime(){
        return function (selectTypeArray) {
          return new Date(selectTypeArray)
        }
      }
    },
    data(){
      return {
        commentCompany:"评价企业",
        commentType:"评价类型",
        commentProgress:"评价流程",
        commentPeriod:'',//评价期间的时间段
        isShowCommentPeriod:false,//评价期间  时间选择

        loading:true,
        commentTableData:[
          {
            ID:'1001'
          }
        ],
        page:1,
        pageSize:1,
        total:0,
        currentPage:1,
        pageCount:0,
        tableData:[],
        downloadLoading:false,
        tableData2:[],
        limit: 10,
        companySelect:'评价企业',
        companyList: [],
        evaluationPeriodSelect: '评价期间',
        evaluationPeriodList: [],
        commentProgress:"评价流程",
        commentProgressArray:[],
        evaluationType:[],
      }
    },
    components:{
      userHeader,
    },
    methods:{
      //选择公司
      setCompanySelect(command) {
        if(command=='none'){
          return false
        };
        this.companySelect = command.company_name;
        this.companySelectId = command.company_id;
        this.evaluationPeriodSelect='评价期间';
        this.commentType='评价类型';
        this.commentProgress='评价流程';
        this.commentTypeId='';
        this.EvaluationPeriodId='';
        this.processId='';
//        this.initData(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.initData2(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.loading =true;
        this.getCompanyEvaluationPeriod(command.company_id).then(res => {
          console.log(res.data.data)
          if (res.data.code == 0) {
            this.evaluationPeriodList = res.data.data
          }
        });
        //获取评价类型
        this.axios.get('/api/v1/enquiry/evaplantypequery',{
          params:{
            company_id:this.companySelectId,
          }
        }).then((res)=>{
          if(res.data.code==0){
            this.evaluationType =res.data.data;
          }
        })
      },
      //获取公司列表
      getCompanyList() {
        this.axios.get('/api/v1/enquiry/companyflat')
          .then((res) => {
            var companyList = [];
            if (res.data.code == 0) {
              console.log((res.data.data))
              this.companyList = this.formatSonCompany(res.data.data)
              console.log(this.companyList)
            }
          })
      },
      //将公司列表树状结构转化为数组
      formatSonCompany(data) {
        var temp = [], list = [];

        function copySonCompany(obj) {
          temp = [...temp, obj]
          if (obj.son_company.length > 0) {
            obj.son_company.forEach(element => {
              copySonCompany(element)
            })
          }
          return temp
        }

        data.forEach(el => {
          list = [...list, ...copySonCompany(el)]
        })
        return list
      },
      // 选择期间
      setEvaluationPeriod(command) {
        if(command=='none'){
          return false
        };
        this.evaluationPeriodSelect = command;
        this.EvaluationPeriodId =command;
        this.loading =true;
//        this.initData(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.initData2(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        //评价类型
        this.axios.get('/api/v1/enquiry/evaplantypequery',{
          params:{
            company_id:this.companySelectId,
            evaluation_period:this.evaluationPeriodSelect
          }
        }).then((res)=>{
          if(res.data.code==0){
            this.evaluationType =res.data.data;
          }
        })
      },
      //评价类型选择
      handleCommentType(command){
        //一级流程列表
        if(command=='noCommentType'){
          return false
        };
        this.commentTypeId=command.evaplan_type_id;
        this.commentType =command.evaplan_type_name;
        this.loading =true;
//        this.initData(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.initData2(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
      },

      //评价流程选择
      handleCommentProgress(command){
        if(command=='noCommentType'){
          return false
        };
        this.processId=command.process_id;
        this.commentProgress =command.process_name;
//        this.initData(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.initData2(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
      },
      initLcProgress(){
        this.axios.get('/api/v1/enquiry/topprocess')
          .then((res)=>{
            console.log(res.data);
            this.commentProgressArray =res.data.data;
          });
      },
      getCompanyEvaluationPeriod(company_id) {
        return this.axios.get('/api/v1/flow/controlindicators?company_id=' + company_id)
      },
      //评价企业
      handleCommentCompany(command){
        console.log(command)
      },
      //评价期间选择弹出
      showCommentPeriod(){
        this.isShowCommentPeriod = true;
      },
      //评价期间选择关闭
      selectCommentPeriod(){
        this.isShowCommentPeriod = false;
      },
      //评价类型选择
//      handleCommentType(command){
//        console.log(command)
//      },
//      //评价流程选择
//      handleCommentProgress(){
//        console.log(command)
//      },
      tableRowClassName2 ({row, rowIndex}) {
        //把每一行的索引放进row
        row.index = rowIndex;
      },
      cell({row, column, rowIndex, columnIndex}) {
        //第八列添加 red 类
        if (columnIndex == 1) {
          return "first-table-clouum"
        }
        if (columnIndex == 11||columnIndex==17||columnIndex==20) {
          return 'walk_through'
        }
        if (columnIndex == 12) {
          return 'defect_states'
        }
        if(columnIndex == 14||columnIndex==15||columnIndex==18||columnIndex==19||columnIndex==21){
          return 'mend_principal'
        }
        if(columnIndex == 16){
          return 'datePicker'
        };
      },
      //分页状态改变
      currentChange(val){
        this.page =val;
        this.loading =true;
//        this.initData(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
        this.initData2(this.page,this.companySelectId,this.EvaluationPeriodId,this.commentTypeId,this.processId);
      },
      initData(page,company_id='',evaluation_period='',evaplan_type_id='',process_id=''){
        this.axios.get('/api/v1/enquiry/defectrectificationenquiry',{
          params:{
            limit:10,
            page:page,
            company_id:company_id,
            evaluation_period:evaluation_period,
            evaplan_type_id,evaplan_type_id,
            process_id:process_id,
          }
        })
          .then((res)=>{
            if(res.data.code==0){
              this.loading =false;
              this.tableData =res.data.data;
              console.log(this.tableData);
              this.total = res.data.pagination.total
              this.pageSize =res.data.pagination.pages;
              this.currentPage=parseInt(res.data.pagination.page)
            }
          })
      },
      initData2(page,company_id='',evaluation_period='',evaplan_type_id='',process_id=''){
        this.axios.get("/api/v1/enquiry/defectrectificationquery",{
            params:{
              limit:10,
              page:page,
              company_id:company_id,
              evaluation_period:evaluation_period,
              evaplan_type_id,evaplan_type_id,
              process_id:process_id,
            }
        }).then(res => {
          if (res.data.code == 0) {
            console.log(res.data.data)
            this.loading =false;
            this.tableData =res.data.data;
            console.log(this.tableData);
            this.total = res.data.pagination.total
            this.pageSize =res.data.pagination.pages;
            this.currentPage=parseInt(res.data.pagination.page)
            this.commentTableData = res.data.data
          } else {
            this.$alert(res.data.message, "提示")
          }
        });
      },
      downLoadFile(){
        if(this.commentTableData.length>0){
          this.downloadLoading = true
          import('../utils/export2Excel').then(excel => {
            const filterVal = ['numrow', 'process_name', 'evaluation_content', 'evaluation_criterion', 'defect_title','def_rec_state_text','defect_property_text','defect_impact_results','suggestions_improvement','section_name',
              'section_principal','defect_state_text','communication_ideas','mend_principal[0].name','defect_reason_analysis','rectification_measures','evaluation_finishtime','defect_source',
            'rectification_results','reasons_measures','def_rec_state_text','implementation_opinions']
            const tHeader = ['编号', '评价流程', '评价点名称', '评价标准', '评价结论','缺陷来源','缺陷性质','缺陷影响结果','改进建议','责任部门','责任部门负责人','缺陷确认','沟通意见'
            ,'整改负责人','缺陷原因分析','整改计划','计划完成时间','复核计划','整改结果','未整改原因及措施','整改结果确认','落实意见']
            //此处为 合计的数据
            const list = [...this.commentTableData]
            const data = this.formatJson(filterVal, list)
            excel.export_json_to_excel({
              header: tHeader,
              data:data,
              filename:"缺陷统计表（第"+this.page+"页）",
              autoWidth: true,
              bookType: "xlsx"
            })
            this.downloadLoading = false

          })
        }else {
          this.$alert("表格无数据，无法下载","提示")
        }

      },
      formatJson(filterVal, jsonData) {
        return jsonData.map(v => filterVal.map(j => v[j]))
      }
    },
    mounted(){
//        this.initData(this.page,sessionStorage.getItem('company_id'));
        this.initData2(this.page,sessionStorage.getItem('company_id'));
        this.getCompanyList();
        this.initLcProgress();
    }
  })
</script>
<style scoped="">
  .defectFixedIndex{
    width: 100%;
    height: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    padding: 10px;
  }
  .defectFixedIndex>>> .navList>div{
    background:none;
  }
  .defectFixedIndex>>> .navList{
    padding-bottom:12px;
    margin-bottom:12px;
  }
  .defectFixedIndex >>> .el-table thead th.is-leaf .cell{
    font-size: 14px;
  }
  .defectFixedIndex .mend_principal .cell .mend_principal_scope .mend_principal_cell{
    color: #4479bf;
  }
  .defectFixedIndex >>> .mend_principal_scope{
    margin-left: -10px;
    margin-right: -10px;
  }
  .defectFixedIndex >>> .mend_principal_scope .mend_principal_cell .el-textarea{
    padding:  0 3px;
  }
  .defectFixedIndex >>> .mend_principal_scope .mend_principal_cell .el-textarea__inner{
    padding: 2px 2px;
  }
  .defectFixedIndex >>> .mend_principal_scope .mend_principal_cell .el-textarea__inner .el-input__icon{
    position: absolute;
    right: 25px;
  }
  .defectFixedIndex >>> .cell textarea{
    width: 100%;
    height: auto;
  }
  .defectFixedIndex >>> .cell .el-input{
    width: auto;
  }
  .defectFixedIndex >>> .cell .el-input__inner{
    border: 0;
    background: none;
    padding: 0;
    width: 100%;
  }
  .defectFixedIndex >>> .datePicker .cell .el-input__inner{
    padding-left: 20px;
  }

  .defectFixedIndex >>> .datePicker .cell .el-input__inner .el-input__prefix{
    width: 15px;
    left: -3px;
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasOne{
    line-height: 18px;
    font-size: 12px;
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasTwo{
    position: relative;
    width: 100%;
    min-height: 40px;
    font-size: 12px;
    height: 60px;
    position: relative;
    width: 100%;
    min-height: 40px;
    line-height: 17px;
    font-size: 12px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;

  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasOne{
    /*padding-bottom: 10px;*/
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasTwo:nth-child(1){
    padding-bottom: 10px;
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasTwo:nth-child(2){
    padding-top: 10px;
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasTwo:nth-child(1):after{
    position: absolute;
    content: '';
    left: 0;
    height: 1px;
    bottom:0;
    background: #aac983;
    width: 100%;
  }
  .defectFixedIndex >>> .cell .mend_principal_scope .hasTwo:nth-child(2):after{
    position: absolute;
    content: '';
    left: 0;
    height: 1px;
    top:-1px;
    background: #aac983;
    width: 100%;
  }
  .defectFixedIndex >>>  .el-dialog{
    width: 400px;
  }
  .defectFixedIndex >>>  .el-dialog .el-dialog__body{
    padding: 10px 8px;
  }
  .defectFixedIndex >>>  .dialog-footer .el-button{
    padding: 10px 16px;
    margin-top: 10px;
    /*background: #8cc34b;*/
  }
  .defectFixedIndex >>>  .dialog-footer{
    text-align: right;
  }
  .defectFixedIndex >>> .defect_state .el-form-item__label{
    /*width: 100px;*/
  }

  .defectFixedIndex >>> .defect_state .el-dialog{
    width: 520px;
  }
  .defectFixedIndex >>> .defect_states .el-textarea__inner{
    padding: 1px 1px;
  }
  .defectFixedIndex >>> .defect_states .cell{
    padding: 2px 2px;
  }
  .defectFixedIndex .download-file {
    margin-right: 36px;
    margin-top: 14px;
    float: right;
    padding: 7px 8px;
    background: #769dd6;
    border: none;
    font-size: 20px;
    text-align: center;
    cursor: pointer;
  }
  @media screen and (max-width: 1400px){
    .defectFixedIndex{
      padding: 6px;
    }
  }
</style>
